<template>
  <cfg-form :ref="ref" v-bind="attrs" :data="data.values"></cfg-form>
</template>

<script>
const ref = "editView";
export default {
  name: ref,
  components: {},
  inject: ["anc"],
  data() {
    return {
      ref,
    };
  },
  props: {
    data: {
      default: () => {
        return {};
      },
    },
  },
  watch: {},
  computed: {
     attrs() {
      return {
        labelWidth: 100,
        labelPosition: "right",
        cols: 2,
        onlyRead: false,
        columns: [
          {
            key: "sf_code",
            title: "仓库编号",
            minWidth: 200,
            align: "center",
            show: true,
            config: { type: "text" },
          },
          {
            key: "sf_name",
            title: "仓库名称",
            minWidth: 200,
            align: "center",
            show: true,
            config: { type: "text" },
          },
          {
            key: "address",
            title: "仓库地址",
            minWidth: 100,
            align: "center",
            show: true,
            config: {
              type: "text",
            },
          },

          {
            key: "dutyFarm",
            title: "责任车间",
            minWidth: 100,
            align: "center",
            show: true,
            config: { type: "text" },
          },
          {
            key: "dutyGroup",
            title: "责任班组",
            minWidth: 100,
            align: "center",
            show: true,
            config: { type: "select", options: this.anc.teamData },
          },
          {
            key: "leaderId",
            title: "负责人名称",
            minWidth: 100,
            align: "center",
            show: true,
            config: { type: "select", options: this.anc.personData },
          },
          {
            key: "status",
            title: "状态",
            minWidth: 100,
            align: "center",
            show: true,
            config: {
              type: "select",
              options: [
                { label: "启用", value: "启用" },
                { label: "停用", value: "停用" },
              ],
            },
          },

          {
            key: "type",
            title: "类别",
            minWidth: 100,
            align: "center",
            show: true,
            config: {
              type: "select",
              options: [
                { label: "产品", value: "产品" },
                { label: "物料", value: "物料" },
              ],
            },
          },
          {
            key: "technology",
            title: "工艺",
            minWidth: 100,
            align: "center",
            show: true,
            config: {
              type: "select",
              options: [
                { label: "启用", value: "启用" },
                { label: "停用", value: "停用" },
              ],
            },
          },
          {
            key: "line",
            title: "行",
            minWidth: 100,
            align: "center",
            show: true,
            config: { type: "number" },
          },
          {
            key: "column",
            title: "列",
            minWidth: 100,
            align: "center",
            show: true,
            config: { type: "number" },
          },
          {
            key: "remark",
            title: "备注",
            minWidth: 100,
            align: "center",
            show: true,
            config: { type: "textarea" },
          },
        ],
        rules: {
        
          line: [
            {
              required: true,
              message: "请选择",
              trigger: "change",
              type: "number",
            },
          ],
           column: [
            {
              required: true,
              message: "请选择",
              trigger: "change",
              type: "number",
            },
          ],
        },
        // onlyRead: this.onlyRead,
      };
    },
  },
  created() {},
  mounted() {
    this.$nextTick(() => {
      this.$set(this.anc.vms, this.ref, this);
    });
  },
  methods: {
    validate(fn) {
      return this.$refs[this.ref].$refs["form"].validate((valid) => {
        if (fn) {
          return fn(valid);
        } else {
          return valid;
        }
      });
    },
    resetFields() {
      this.$refs[this.ref].$refs["form"].resetFields();
    },
  },
};
</script>
<style scoped></style>
